package com.cloudkinto.service.mail.impl;

public class DeliveredStateFuture {

    private DeliveredState state = DeliveredState.INITIAL;

    synchronized void waitForReady() throws InterruptedException {
        if (state == DeliveredState.INITIAL) {
            wait();
        }
    }

    synchronized DeliveredState getState() {
        return state;
    }

    synchronized void setState(DeliveredState newState) {
        state = newState;
        notifyAll();
    }

    public enum DeliveredState {
        INITIAL, MESSAGE_DELIVERED, MESSAGE_NOT_DELIVERED, MESSAGE_PARTIALLY_DELIVERED,
    }
}